/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.agenda.model.entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Ronildo
 */
@Entity
@Table(name = "AM_TB_UF")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "AmTbUf.findAll", query = "SELECT a FROM AmTbUf a"),
    @NamedQuery(name = "AmTbUf.findByCdUf", query = "SELECT a FROM AmTbUf a WHERE a.cdUf = :cdUf")})
public class AmTbUf implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 2)
    @Column(name = "CD_UF")
    private String cdUf;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "cdUf")
    private Collection<AmTbCida> amTbCidaCollection;

    public AmTbUf() {
    }

    public AmTbUf(String cdUf) {
        this.cdUf = cdUf;
    }

    public String getCdUf() {
        return cdUf;
    }

    public void setCdUf(String cdUf) {
        this.cdUf = cdUf;
    }

    @XmlTransient
    public Collection<AmTbCida> getAmTbCidaCollection() {
        return amTbCidaCollection;
    }

    public void setAmTbCidaCollection(Collection<AmTbCida> amTbCidaCollection) {
        this.amTbCidaCollection = amTbCidaCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (cdUf != null ? cdUf.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof AmTbUf)) {
            return false;
        }
        AmTbUf other = (AmTbUf) object;
        if ((this.cdUf == null && other.cdUf != null) || (this.cdUf != null && !this.cdUf.equals(other.cdUf))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.agenda.model.entity.AmTbUf[ cdUf=" + cdUf + " ]";
    }
    
}
